package com.xbongbong.saas.config;

import com.xbongbong.saas.service.recheck.abstracts.RecheckSearchStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Map;
import java.util.stream.Collectors;

/**
 * 查重策略config
 * @author 李江仁
 *
 */
@Configuration
public class RecheckingConfig {

    @Autowired
    private Map<String, RecheckSearchStrategy> recheckSearchStrategyMap;

    @Bean("recheckSearchStrategyMap")
    public Map<Integer, RecheckSearchStrategy> businessListMap() {
        return recheckSearchStrategyMap.values().stream().collect(Collectors.toMap(RecheckSearchStrategy::type, t -> t));
    }

}
